<!DOCTYPE html>
<html>
<head>
    <include file="Include:meta"/>
    <title>添加项目-目的地运营集团数据管理平台</title>
    <include file="Include:style"/>
    <style>
        .w50 {
            width: 50px;
        }
    </style>
    <!--<script src="__PUBLIC__/js/city/area.js"></script>-->
    <script src="__PUBLIC__/js/select/jquery.multi-select.js"></script>
</head>
<body>
<include file="Include:header"/>
<include file="Include:left"/>
<div id="main">
    <div class="crumbs">
        <div class="crumbs-text">项目列表 > 添加项目</div>
    </div>
    <div id="content">
        <form action="__APP__/CrmProject/add" method="post" id="crmproject_add_form">
            <div class="form-main">
                <div class="form-title">添加项目</div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>关联需求</div>
                    <div class="input-item">
                        <select name="information_id" class="form-control w400 required_select" autocomplete="off"
                                required>
                            <option value="">全部</option>
                            <foreach name="res_information" item="vo">
                                <option value="{$vo.information_id}"
                                <if condition="$information_id eq $vo['information_id']">selected</if>
                                >{$vo.customer_name}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目名称</div>
                    <div class="input-item">
                        <input type="text" class="form-control w400" name="name" autocomplete="off" required>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目简称</div>
                    <div class="input-item">
                        <input type="text" class="form-control w200" name="short_name" autocomplete="off" required>
                        <span class="error-item">必填项</span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>负责人</div>
                    <div class="input-item">
                        <select name="leader" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <option value="{:$_SESSION['dms_uid']}">{:$_SESSION['dms_username']}</option>
                            <foreach name="user_list" item="vo">
                                <option value="{$vo.id}">{$vo.username}</option>
                            </foreach>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目性质</div>
                    <div class="input-item">
                        <select name="nature" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <option value="">请选择</option>
                            <for start="1" end="5">
                                <option value="{$i}">{:get_nature($i)}</option>
                            </for>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目类型</div>
                    <div class="input-item">
                        <select name="type[]" class="form-control w200 required_select" multiple='multiple' autocomplete="off"
                                required>
                            <option value="">请选择</option>
                            <for start="1" end="7">
                                <option value="{$i}">{:get_project_type($i)}</option>
                            </for>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目阶段</div>
                    <div class="input-item">
                        <select name="stage" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <option value="">请选择</option>
                            <for start="1" end="7">
                                <option value="{$i}">{:get_project_stage($i)}</option>
                            </for>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">重要程度</div>
                    <div class="input-item">
                        <for start="1" end="5">
                            <label class="radio-inline" for="importance{$i}">
                                <input type="radio" name="importance" id="importance{$i}" value="{$i}">{:get_project_importance($i)}
                            </label>
                        </for>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目规模</div>
                    <div class="input-item">
                        <select name="size" class="form-control w200 required_select" autocomplete="off"
                                required>
                            <option value="">请选择</option>
                            <for start="1" end="6">
                                <option value="{$i}">{:get_project_size($i)}</option>
                            </for>
                        </select>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">项目网站</div>
                    <div class="input-item">
                        <input type="text" class="form-control w200" name="website" placeholder="http://"
                               autocomplete="off">
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">地址</div>
                    <div class="input-item">
                        <select name="province_id" class="form-control w100" autocomplete="off">
                            <option value='-10'>省</option>
                            <foreach name="province_list" item="vo">
                                <option value="{$vo['id']}">{$vo['name']}</option>
                            </foreach>
                        </select>
                        <select name="city_id" class="form-control w100" autocomplete="off">
                            <option value='-10'>市</option>
                        </select>
                        <input type="text" name="address" class="form-control w380" placeholder="详细地址（可不填）" autocomplete="off">
                        <span class="error-item"></span>
                    </div>
                </div>
                <!--<div class="form-item">
                    <div class="input-label">项目地址</div>
                    <div class="input-item">
                        <select id="s_province" name="s_province" class="form-control w100 required_select"></select>
                        <select id="s_city" name="s_city" class="form-control w100 required_select"></select>
                        <select id="s_county" name="s_county" class="form-control w100 required_select"></select>
                        <input type="text" placeholder="详细地址" class="form-control w300" name="detail_address"
                               autocomplete="off">
                        <div id="show"></div>
                    </div>
                </div>-->
                <div class="form-item">
                    <div class="input-label">公司名称</div>
                    <div class="input-item">
                        <span><input type="text" class="form-control w200" name="company_name"
                                     autocomplete="off"></span>
                        <span>公司性质
                            <select name="company_nature" class="form-control w200 required_select" autocomplete="off">
                                <option value="">请选择</option>
                                <option value="政府">政府</option>
                                <option value="民营">民营</option>
                                <option value="国企">国企</option>
                                <option value="合资">合资</option>
                                <option value="外资">外资</option>
                        </select></span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目简介</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="intro" autocomplete="off" required></textarea>
                        <br>
                        <span style="color: grey">（包含项目区位，面积，资源，规模，接待量等信息）</span>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>合作诉求</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="work_demands" autocomplete="off" required></textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>甲方背景</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="backdrop" autocomplete="off" required></textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>项目预判</div>
                    <div class="input-item">
                        <textarea class="form-control w400" name="prognosis" autocomplete="off" required></textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">备注</div>
                    <div class="input-item">
                        <textarea name="remark" class="form-control w400" autocomplete="off"></textarea>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label"><span class="asterisk">*</span>添加主要联系人</div>
                    <div class="input-item">
                        <select name="main_linkman" class="form-control w200"
                                autocomplete="off" required>
                            <option value="-10">请选择</option>
                            <foreach name="res_crm_contact" item="vo">
                                <option value="{$vo['contact_id']}">{$vo['username']}-{$vo['mobilephone']}</option>
                            </foreach>
                        </select>
                        <button type="button" class="btn add_cus" refresh=0>添加客户</button>
                    </div>
                </div>
                <div class="form-item">
                    <div class="input-label">添加其他联系人</div>
                    <div class="input-item">
                        <select name="other_linkman[]" id="other_linkman" multiple='multiple' class="form-control w400"
                                autocomplete="off">
                            <foreach name="res_crm_contact" item="vo">
                                <option value="{$vo['contact_id']}">{$vo['username']}-{$vo['mobilephone']}</option>
                            </foreach>
                        </select>
                        <!--<input type="text" class="form-control w200" name="main_linkman" autocomplete="off" required>
                        <span class="error-item">必填项</span>-->
                    </div>
                </div>
            </div>
            <div class="form-btn-item"><input type="submit" value="提交" class="btn btn-submit">
                <button class="btn btn-default goback" type="button">返回</button>
            </div>
        </form>
    </div>
</div>
<!--弹出框-->
<include file="Crm:contact_ajax_add"/>
</body>
<include file="Include:javascript"/>
<!--<script type="text/javascript">_init_area();</script>-->
<!--<script type="text/javascript">
$(function(){
    var Gid = document.getElementById;
    var showArea = function () {
        Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +
            Gid('s_city').value + " - 县/区" +
            Gid('s_county').value + "</h3>"
    }
    Gid('s_county').setAttribute('onchange', 'showArea()');
});
</script>-->
<include file="Crm:javascript_contact"/>
<script type="text/javascript">
    var init_name = $("select[name='information_id']").find("option:selected").text()
    if (init_name == '全部') init_name = ''
    $("input[name='name']").val(init_name);
    $("select[name='information_id']").bind("change", function () {
        var name = $(this).find("option:selected").text();
        if (name == '全部') name = ''
        //向input输入框中赋值
        $("input[name='name']").val(name);
    });
    $(function () {
        /*省市联动*/
        $("[name='province_id']").change(function(){
            var id = $(this).val();
            $.ajax({
                type:"POST",
                dataType:'json',
                data:{'region':id,'type':1,'bool':1},
                url:"__APP__/Communal/get_province_city",
                success:function(data){
                    var option = "";
                    if(data){
                        option += "<option value='-10'>请选择</option>";
                        if(data){
                            for(var i=0;i<data.length;i++){
                                option += "<option value="+data[i].id+">"+data[i].name+"</option>";
                            }
                        }
                    }else{
                        option += "<option value='-10'>市</option>";
                    }
                    $("[name='city_id']").html(option).select2();
                }
            });
        });
    })
</script>
</html>